package mover;

public abstract class GameMover implements Cloneable {
	protected int xPos = 0, yPos = 0, xMove = 0, yMove = 0;
	protected double xMult = 1, yMult = 1;

	public abstract void move(int counter);

	public  void reset() {
		xPos = yPos = 0;
	}
	
	public void bounce(boolean xAxis, int overlay) {
		// Will ensure that the elements bounce
		if(xAxis) {
			xMove *= -1;
		} else {
			yMove *= -1;
		}
	}

	public int getXPos() { return xPos; }
	public int getYPos() { return yPos; }
	public void setXMult(double mult) { if(Math.abs(xMult) == 1 && mult > 0) this.xMult = mult; }
	public void setYMult(double mult) { if(Math.abs(yMove) == 1 && mult > 0) this.yMult = mult; }
	
	protected int signum(int value) {
		if(value > 0) return 1;
		else if(value < 0) return -1;
		else return 0;
	}
	
	//CLONE
	
	@Override
	public abstract GameMover clone() throws CloneNotSupportedException;
	
	protected void clone_help(GameMover clone) {
		clone.xMove = this.xMove;
		clone.xMult = this.xMult;
		clone.xPos = this.xPos;
		
		clone.yMove = this.yMove;
		clone.yMult = this.yMult;
		clone.yPos = this.yPos;
	}
}